<template>
<div class="container">
  <van-nav-bar
      :title="headTitle"
      left-text="返回"
      left-arrow
      fixed
      @click-left="onClickLeft"
  />
<ReUseCard class="reCard" v-for="item in this.GoodList" :key="item.id" :data="item"> </ReUseCard>
  <div v-if="GoodList.length==0" style="height:150px;line-height: 150px;font-size: 20px;text-align: center;color: #999999">
    空空如也
  </div>
</div>
</template>

<script>
import ReUseCard from "@/components/ReUseCard";
export default {
  name: "ReUseGoods",
  components:{ReUseCard},
  data(){
    return{
      headTitle:'二手购',
      GoodList:[]
    }
  },
  created() {
    switch (this.$route.query.id){
      case 'myOutput':
        this.headTitle='我的卖出'
          this.getMySaleOut()
            break
      case 'myIn':
        this.headTitle='我的订单'
            this.getMyOrders()
            break
      case 'mySend':
        this.headTitle='我的发布'
          this.getMySendList()
            break
      case 'history':
        this.headTitle='浏览历史'
          this.getLookHistory()
            break
      case 'collect':
        this.headTitle='我的收藏'
          this.myCollect()
            break
      default:
        this.headTitle='二手购'
    }
  },
  methods:{
    myCollect(){

    },
    getLookHistory(){

    },
    getMyOrders(){

    },
    getMySaleOut(){
      this.$http.get('/goods/getMySaleOut').then(res=>{
        this.GoodList=res.data.result
      })
    },
    getMySendList(){
      this.$http.get('/goods/mySend').then((res)=>{
        this.GoodList=res.data.result
      })
    },
    onClickLeft(){
       this.$router.back()
    }
  }
}
</script>

<style scoped lang="less">
.container{
  padding-top: 50px;
  .reCard{
    height: 100px;
  }
}

</style>
